/**
  * @(#)ClassLevel.java
  *
  * Enumerator describing the registration level for the course
  *
  * @author Course Scheduler Team
  * 
  * @license GNU General Public License version 3 (GPLv3)
  *
  * This file is part of Course Scheduler, an open source, cross platform
  * course scheduling tool, configurable for most universities.
  *
  * Copyright (C) 2010-2012 Course Scheduler Team
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation, either version 3 of the License, or
  * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  * 
  */
package com.pollicitus.scheduler.model;

import java.util.HashMap;
import java.util.Map;

import com.pollicitus.scheduler.model.ClassLevel;
import com.pollicitus.scheduler.util.Enumeration;

/**
 * @author Course Scheduler Team
 *
 * Enumerator describing the registration level for the course
 */
/**
 * @author Course Scheduler Team
 *
 */
public class ClassLevel extends Enumeration<ClassLevel>{	

	/**
	 * The most recent revision in which this file was changed in the source control system
	 */
	public static final String _revision = "$LastChangedRevision: 539 $";
	
	/**
	 * The date on which this file was last changed and submitted to source control
	 */
	public static final String _date = "$LastChangedDate: 2011-11-19 23:14:16 -0500 (Sat, 19 Nov 2011) $";
	
	/**
	 * The user which last changed the file and committed the change to source control
	 */
	public static final String _author = "$LastChangedBy: mike@pollicitus.com $";
	
	/**
	 * The URL which can be used to access this specific file within the source control system
	 */
	public static final String _headURL = "$HeadURL: https://courseschedulerx.googlecode.com/svn/trunk/course-scheduler/course-scheduler-core/src/main/java/com/pollicitus/scheduler/model/ClassLevel.java $";
	
	/**
	 * The source control file ID, comprised of the file name, latest revision, last changed date, and submitting user.
	 */
	public static final String _id = "$Id: ClassLevel.java 539 2011-11-20 04:14:16Z mike@pollicitus.com $";
	
	//static class variables
	protected static Map<String, ClassLevel> values = new HashMap<String, ClassLevel>();
	
	//public enumeration values
	public static ClassLevel UNDERGRADUATE;
	public static ClassLevel GRADUATE;			
	public static ClassLevel POSTGRADUATE;		
	
	/**
	 * Return the appropriate instance of the enumeration based on the
	 * enumeration name.
	 * 
	 * @param name the enumeration name of the instance to return
	 * @return enumeration instance
	 */
	public static ClassLevel valueOf(String name){
		return values.get(name.toUpperCase());
	}

	/**
	 * Return an array with the enumeration values 
	 * 
	 * @return array containing enumeration values
	 */
	public static ClassLevel[] values() {
		return values.values().toArray(new ClassLevel[values.size()]);
	}
	
	/**
	 * @param description
	 */
	protected ClassLevel(String name, String description) {
		super(name, description, values.size());
	}

	/* (non-Javadoc)
	 * @see com.scheduler.util.Enumeration#register()
	 */
	@Override
	protected void register() {
		if(values.get(this.name.toUpperCase()) == null){
			values.put(this.name.toUpperCase(), this);
		}
	}
}